<template>
  <div class="user-wrapper">
    <div class="user-title">
      <van-button
        class="btn-back"
        icon="arrow-left"
        :to="{ name: 'user' }" />
      {{ $t('User.my_wallet') }}
    </div>
    <div class="wallet-box">
      <div class="remain">
        {{ $t('User.remain_maney') }}
        <div class="remain-maney">{{ remainManey }}</div>
        <van-button
          class="cash-out"
          @click="cashOut">{{ $t('User.cashout') }}</van-button>
      </div>
      <div class="settle-accounts">
        <div class="settle">
          {{ $t('User.settle_amount') }}
          <p class="settle-amount">{{ settleAmount }}</p>
        </div>
        <div class="settle align-right">
          {{ $t('User.settled_amount') }}
          <p class="settle-amount">{{ settledAmount }}</p>
        </div>
      </div>
    </div>
    <div class="income" v-if="incomeList.length">
      <p class="income-title">{{ $t('User.income') }}</p>
      <ul>
        <li v-for="(item, index) in incomeList" :key="index">
          <div class="source">
            <p class="income-source">{{ item.source }}</p>
            <p class="time">{{ item.time }}</p>
          </div>
          <p :class="{ 'money-income': item.amount > 0, 'money-expend': item.amount < 0 }">{{ item.amount }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      remainManey: 134443412,
      settleAmount: 134443412,
      settledAmount: 134443412,
      incomeList: [
        {
          source: 'xxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxx',
          time: '777',
          amount: -10,
        },
        {
          source: 'xxx',
          time: '777',
          amount: 20,
        },
        {
          source: 'xxx',
          time: '777',
          amount: 10,
        },
      ]
    };
  },
  methods: {
    cashOut() {

    }
  }
};
</script>

<style lang="less" scoped>
  .wallet-box{
    min-height: 360px;
    background: url('../../assets/images/wallet-bg@2x.png') no-repeat 50% 50%;
    background-size: contain;
    padding: 50px 60px 0;
    margin: 10px 20px;
    font-size: @font-size-sm;
    color: #fff;
  }
  .remain{
    position: relative;
    margin-bottom: 50px;
  }
  .remain-maney{
    font-size:60px;
    margin-right: 200px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }
  .cash-out{
    width:170px;
    height:50px;
    line-height:50px;
    background: none;
    position: absolute;
    top: 30px;
    right: 0;
    border:1px solid rgba(234, 234, 234, 1);
    box-shadow:0 6px 26px 1px rgba(0, 0, 0, 0.08);
    border-radius:12px;
    color: #fff;
  }
  .settle-accounts{
    display: flex;
    justify-content: space-between;
  }
  .settle{font-family: 'PingFang-SC-Regular';}
  .settle-amount{
    font-size:36px;
    margin-top: 10px;
  }
  .align-right{text-align: right;}
  .income{
    background: #fff;
    padding: 30px 40px;
    font-size: @font-size-md;
  }
  .income-title{
    margin-bottom: 30px;
    font-size: @font-size-lg;
    color: #666;
  }
  li{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-top: 1Px solid #F5F5F5;
    &:first-child{border-top: 0;}
  }
  .income-source{
    line-height: 36px;
    margin-bottom: 14px;
  }
  .time{
    font-size:@font-size-sm;
    color: #999;
  }
  .money-income{
    font-size:40px;
    font-weight:bold;
    color:@orange;
  }
  .money-expend{
    font-size:40px;
    font-weight:bold;
    color:#656565;
  }
</style>
